import Baby from './Baby.js'
class Star extends Baby{
  constructor(x,y,rate,maxY,pEle){
    super(x,y,rate,maxY,pEle)
  }
}
class Money extends Baby{
  constructor(x,y,rate,maxY,pEle,addX){
    super(x,y,rate,maxY,pEle)
    this.addX=addX;//开始加速的位置
    this.img.src="imgs/像素_金币.png"
  }
  getRate(){//星星向下掉的方法
    return this.top>this.addX?parseInt(this.rate*3):this.rate;
  }
}
class Diamond extends Baby{
  constructor(x,y,rate,maxY,pEle){
    super(x,y,rate,maxY,pEle)
    this.img.src="imgs/像素_爱心.png"
  }
  getXRate(){//星星左右飘动的方法
    return 10;
  } 
}
class Box extends Baby{
  constructor(x,y,rate,maxY,pEle){
    super(x,y,rate,maxY,pEle)
    this.img.src="imgs/像素_药水.png"
    this.nice = 10
  }
  getRate(){
    if(this.top>(this.maxY-30)){
      this.nice--
      if(this.nice>0){
        return 0
      }
    }
    return this.rate
  }
  reset(){
    Baby.prototype.reset.call(this)
    this.nice=10
  }
}

export {Box,Diamond,Money,Star}